/**
 * Copyright (C) 2013-2014 the original author or authors.
 */
package com.foreveross.bsl.mam.rbac.application;

import java.util.List;
import java.util.Map;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import com.foreveross.bsl.mam.rbac.application.vo.PrivilegeVO;
import com.foreveross.bsl.mam.rbac.application.vo.RoleVO;

/**
 * <BR>
 * [功能详细描述]
 * 
 * @author Amberlo
 * @version [mam-application , 2013-6-28]
 */
@Path(value = "/privilege")
public interface PrivilegeApplication {

	@POST
	@Path("/add")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public PrivilegeVO saveEntity(PrivilegeVO entity);

	@PUT
	@Path("/update/")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public PrivilegeVO updateEntity(PrivilegeVO entity);

	@POST
	@Path("/delete")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public void deleteEntity(PrivilegeVO entity);

	@GET
	@Path("/get/{id}")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public PrivilegeVO getEntity(@PathParam("id") String id);

	@GET
	@Path("/all")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public List<PrivilegeVO> findAll();

	@POST
	@Path("/findAll")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public Page<PrivilegeVO> findByPageable(Pageable pageable);

	@GET
	@Path("/findByRoleID")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public List<PrivilegeVO> getPrivilegesByRoleID(
			@QueryParam("roleID") String roleID);

	@GET
	@Path("/getPrivilegeByIDs")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public PrivilegeVO getPrivilegeByIDs(@QueryParam("roleID") String roleID,
			@QueryParam("appID") String appID,
			@QueryParam("moduleID") String moduleID);

	@GET
	@Path("/getAppPrivilegeByRoleID")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public List<PrivilegeVO> getAppPrivilegeByRoleID(
			@QueryParam("roleID") String roleID,
			@QueryParam("appID") String appID);

	@DELETE
	@Path("/deleteRole")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public void deletePrivilegesByRoleID(@QueryParam("roleID") String roleID);

	@DELETE
	@Path("/deleteRoles")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public void deletePrivilegesByRoleIDs(@QueryParam("roleID") String roleID,
			@QueryParam("appID") String appID);

	@GET
	@Path("/findAuth")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public Map<String, List> authorize(@QueryParam("username") String username,
			@QueryParam("appID") String appID);

	@GET
	@Path("/roles/priviliges")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public List<RoleVO> rolesPriviliges(
			@QueryParam("username") String username,
			@QueryParam("appID") String appID);

	@GET
	@Path("/findRoles")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public List<RoleVO> findRoles(@QueryParam("username") String username,
			@QueryParam("appID") String appID);

	@DELETE
	@Path("/deleteWidget")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public void deletePrivilegesByWidget(
			@QueryParam("module_ID") String module_ID);

	@DELETE
	@Path("/deleteApp")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public void deletePrivilegesByAppId(@QueryParam("app_ID") String app_ID);

	@GET
	@Path("/privilegesByOperId")
	@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
	public List<PrivilegeVO> getPrivilegesByOperId(
			@QueryParam("operId") String operId);
}
